package com.tensquare.user.config;

import com.tensquare.user.interceptor.UserJwtInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class UserApplicationConfig extends WebMvcConfigurationSupport {

    @Autowired
    private UserJwtInterceptor userJwtInterceptor;

    // 注册拦截器，需要声明拦截器[对象,请求]
    protected void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(userJwtInterceptor).addPathPatterns("/**").
                excludePathPatterns("/**/login/**");
    }

}
